<template>
  <el-card header="我的已办">
    <el-form :inline="true" :model="queryParam">
      <el-form-item>
        <el-input
          v-model="queryParam.QueryKey"
          placeholder="标题"
          @change="load"
        />
      </el-form-item>
      <el-form-item>
        <el-radio-group v-model="queryParam.SearchType" @change="load">
          <el-radio-button :label="0">全部</el-radio-button>
          <el-radio-button :label="2">催办</el-radio-button>
          <el-radio-button :label="3">重要</el-radio-button>
          <el-radio-button :label="4">优先</el-radio-button>
          <el-radio-button :label="6">退回的</el-radio-button>
          <el-radio-button :label="7">被打回修改</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-date-picker v-model="queryParam.Begin" placeholder="开始日期" :clearable="true" value-format="yyyy-MM-dd" @change="load" />
        <span style="margin-left: 5px; margin-right: 5px;">至</span>
        <el-date-picker v-model="queryParam.End" placeholder="结束日期" :clearable="true" value-format="yyyy-MM-dd" @change="load" />
      </el-form-item>
    </el-form>
    <el-divider />
    <userMsgList :query="query" />
  </el-card>
</template>

<script>
import userMsgList from '@/components/msg/userMsgList.vue'
export default {
  components: {
    userMsgList
  },
  data() {
    return {
      queryParam: {
        QueryKey: null,
        SearchType: 0,
        Begin: null,
        End: null
      },
      query: {
        QueryKey: null,
        AppId: null,
        Priority: null,
        MsgClassify: '001',
        MsgType: 1,
        MsgStatus: 2,
        IsRead: null,
        IsTimeOut: null,
        Tag: null,
        Begin: null,
        End: null
      }
    }
  },
  computed: {},
  mounted() {
  },
  methods: {
    load() {
      this.query.QueryKey = this.queryParam.QueryKey
      if (this.queryParam.SearchType === 0) {
        this.query.Tag = null
        this.query.Priority = null
      } else if (this.queryParam.SearchType === 2) {
        this.query.Tag = null
        this.query.Priority = [4]
      } else if (this.queryParam.SearchType === 3) {
        this.query.Tag = null
        this.query.Priority = [3]
      } else if (this.queryParam.SearchType === 4) {
        this.query.Tag = null
        this.query.Priority = [2]
      } else if (this.queryParam.SearchType === 6) {
        this.query.Tag = '002'
        this.query.Priority = null
      } else if (this.queryParam.SearchType === 7) {
        this.query.Tag = '003'
        this.query.Priority = null
      }
    }
  }
}
</script>
